#ifndef __USER_CONFIG_H__
#define __USER_CONFIG_H__

#include "gmsi.h"

#define EXAMPLE         ((GMSI_ID_MOCK<<8)+1)
#define CAPTUREIMG      ((GMSI_ID_CLASS<<8)+1)
#define CORRESPONDENT   ((GMSI_ID_CLASS<<8)+2)
#define FLASHLED        ((GMSI_ID_CLASS<<8)+3)

#define PROTOCOL_MAX    12

#define CHECK_HEAD_CORRESPONDENT(A,B)       ((A==0x35)&&(B==0x44)?true:false)
#define CHECK_HEAD_INCLUSIVE(A,B)           ((A==0x5D)&&(B==0xD5)?true:false)
    
typedef uint16_t (*pfcnWrite)(uint8_t chUartNum, uint8_t *pchSendData, uint16_t hwLength);
typedef uint16_t (*pfcnRead)(uint8_t chUartNum, uint8_t *pchReceiveData);

typedef enum {
    // Individually controlled photo taking
    INCLUSIVE_Event_Trigger1 = 1 << 0,
    INCLUSIVE_Event_Trigger2 = 1 << 1,
    INCLUSIVE_Event_Trigger3 = 1 << 2,
    INCLUSIVE_Event_Trigger4 = 1 << 3,
    INCLUSIVE_Event_Trigger5 = 1 << 4,
    // Capture image
    INCLUSIVE_Event_Captureimg = 1 << 5,
    // scattered spots control
    INCLUSIVE_Event_StartScatteredSpots1 = 1 << 6,
    INCLUSIVE_Event_StopScatteredSpots1 = 1 << 7,
    INCLUSIVE_Event_StartScatteredSpots2 = 1 << 8,
    INCLUSIVE_Event_StopScatteredSpots2 = 1 << 9,
    INCLUSIVE_Event_StartScatteredSpots3 = 1 << 10,
    INCLUSIVE_Event_StopScatteredSpots3 = 1 << 11,
    INCLUSIVE_Event_StartScatteredSpotsAll = 1 << 12,
    INCLUSIVE_Event_StopScatteredSpotsAll = 1 << 13,
    // Stepper motor updates position
    INCLUSIVE_Event_UpdatePosition = 1 << 14,
    INCLUSIVE_Event_Max
} INCLUSIVE_Event;

#define USART1_ENABLE           TRUE

#define USART2_ENABLE           TRUE
#define USART2_RS485_ENABLE     TRUE

#define FRAME_HEAD1             0x00
#define FRAME_HEAD2             0x01
#define FRAME_ADDR              0x02
#define FRAME_FUNCTION          0x03
#define FRAME_VALUE             0x04
#define FRAME_CRC1              0x05
#define FRAME_CRC2              0x06

#define PROTOCOL_LENGTH 7

#define FUNCTION_V_LIGHT        0x01
#define FUNCTION_N_LIGHT        0x03
#define FUNCTION_H_LIGHT        0x05
#define FUNCTION_UVLIGHT        0x07
#define FUNCTION_D_LIGHT        0x09
#define FUNCTION_UVLIGHT405     0x0B

// 5D D5
#define FUNCTION_HARD_TRIG      0x21
#define FUNCTION_DISPENSER      0x23
#define FUNCTION_STEP_MOTOR     0x25
#define FRAME_VALUE1            0x04
#define FRAME_VALUE2            0x05
#define FRAME_VALUE3            0x06
#define FRAME_VALUE4            0x04
#define FRAME_VALUE5            0x05
#define FRAME_VALUE6            0x06
#endif